package cn.alf.ssh.mlxt.dao.hibernateImpl;

import javax.annotation.Resource;

import org.hibernate.SessionFactory;
import org.springframework.transaction.annotation.Transactional;

import cn.alf.ssh.mlxt.dao.AddressDao;
import cn.alf.ssh.mlxt.domain.Address;
@Transactional
public class AddressDaoImpl implements AddressDao {
	@Resource
	private SessionFactory sessionFactory;

	@Override
	public void delete(Address address) {
        sessionFactory.getCurrentSession().delete(address);
	}

	@Override
	public Address getAddressById(int id) {
		return (Address) sessionFactory.getCurrentSession().get(Address.class, id);
	}

	@Override
	public void add(Address address) {
		sessionFactory.getCurrentSession().persist(address);
	}

}
